package org.cqust.backend.dto.response.mission.attempt;

import jakarta.persistence.Column;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.cqust.backend.entity.mission.MissionStepVersion;
import org.cqust.backend.entity.mission.attempt.MissionAttempt;
import org.cqust.backend.entity.mission.attempt.MissionStepAttempt;
import org.hibernate.annotations.CreationTimestamp;

import java.time.LocalDateTime;

@Data
public class MissionStepAttemptDTO {

    private String taskType;

    private String title;

    private String description;

    private Float maxScore;

    private Float score;

    private LocalDateTime createdAt;
    /**
     * 使用MissionStepAttempt对象构造MissionStepAttemptDTO对象。
     *
     * @param missionStepAttempt 任务尝试对象
     */
    public MissionStepAttemptDTO(MissionStepAttempt missionStepAttempt,MissionStepVersion missionStepVersion) {
        if( missionStepVersion!= null){
            taskType = missionStepVersion.getTaskType();
            title = missionStepVersion.getTitle();
            description = missionStepVersion.getDescription();
            maxScore = missionStepVersion.getScore();
        }
        score = missionStepAttempt.getScore();
        createdAt = missionStepAttempt.getCreatedAt();
    }
}
